from .models import Area
from rest_framework import serializers


class AreaSerializer(serializers.ModelSerializer):
    """
    行政区划信息序列化器
    """

    class Meta:
        model = Area
        fields = ['id', 'name', 'parent_id']

class SubAreaSerializer(serializers.ModelSerializer):
    area_set = AreaSerializer(many=True,read_only=True)
    class Meta:
        model = Area
        fields = ['area_set']
